using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_MASTERVENDORMap : EntityTypeConfiguration<SO_MASTERVENDOR>
    {
        public SO_MASTERVENDORMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Vendor, t.CURRency });

            // Properties
            this.Property(t => t.Vendor__)
                .HasMaxLength(6);

            this.Property(t => t.Vendor)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.Default_Expense_Account)
                .HasMaxLength(20);

            this.Property(t => t.CURRency)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.address)
                .HasMaxLength(71);

            this.Property(t => t.CONTACT)
                .HasMaxLength(30);

            this.Property(t => t.CITY)
                .HasMaxLength(21);

            this.Property(t => t.FAX)
                .HasMaxLength(12);

            this.Property(t => t.PHONE)
                .HasMaxLength(40);

            this.Property(t => t.Notes)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("SO_MASTERVENDOR");
            this.Property(t => t.Vendor__).HasColumnName("Vendor_#");
            this.Property(t => t.Vendor).HasColumnName("Vendor");
            this.Property(t => t.Default_Expense_Account).HasColumnName("Default_Expense_Account");
            this.Property(t => t.CURRency).HasColumnName("CURRency");
            this.Property(t => t.address).HasColumnName("address");
            this.Property(t => t.CONTACT).HasColumnName("CONTACT");
            this.Property(t => t.CITY).HasColumnName("CITY");
            this.Property(t => t.FAX).HasColumnName("FAX");
            this.Property(t => t.PHONE).HasColumnName("PHONE");
            this.Property(t => t.Notes).HasColumnName("Notes");
        }
    }
}
